#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10;
int c[N], w[N];
int n, m;
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++)cin >> w[i];
	for (int i = 1; i <= m; i++)cin >> c[i];
	int cnt = 0;
	sort(w + 1, w + n + 1);
	sort(c + 1, c + m + 1);
	int j = 1;
	for (int i = 1; i <= n; i++) {
		if (w[i] >= c[j]) {
			cnt++;
			j++;
		}
	}
	cout << cnt << endl;
	/*for (int i = 1; i <= n; i++)cout << w[i] << " ";
	cout << endl;
	for (int i = 1; i <= m; i++)cout << c[i] << " ";*/
	return 0;
}